package com.tsingteng.cosfun.ui.cosfun.presenter;

import com.tsingteng.cosfun.callback.RxObserver;
import com.tsingteng.cosfun.mvp.presenter.BasePresenter;
import com.tsingteng.cosfun.ui.cosfun.contract.ShareContract;
import com.tsingteng.cosfun.ui.cosfun.imodel.ShareModle;

/**
 * 描述 :
 * 创建人: 肖利.
 * 时间:2018/9/10
 * qq(872179966)
 */

public class SharePresenter extends BasePresenter<ShareContract.IShareView> implements ShareContract.ISharePresenter{
    private ShareModle shareModle;
    private ShareContract.IShareView mView;

    public SharePresenter() {
        shareModle = new ShareModle();
    }

    @Override
    public void getXiPuTranspone(String id) {
        mView = getView();
        RxObserver<Integer> rxObserver = new RxObserver<Integer>(this) {
            @Override
            protected void onFaile(int errorCode, String errorMsg) {
//                mView.showFail(errorMsg);
            }
            @Override
            protected void onSuccess(Integer integer) {
                mView.showXiPuTranspone(integer);
            }
        };
        shareModle.getXiPuTranspone(id,rxObserver);
        addDisposable(rxObserver);

    }

    @Override
    public void getVideoTranspone(String id) {
        mView = getView();
        RxObserver<Integer> rxObserver = new RxObserver<Integer>(this) {
            @Override
            protected void onFaile(int errorCode, String errorMsg) {
                mView.showFail(errorMsg);
            }

            @Override
            protected void onSuccess(Integer integer) {
                mView.showVideoTranspone(integer);
            }
        };
        shareModle.getVideoTranspone(id,rxObserver);
        addDisposable(rxObserver);
    }
}
